package com.cspg.design.http;

import com.cspg.design.dto.AuthUserDto;
import com.cspg.design.dto.ProjectDto;
import com.cspg.design.dto.ProjectFilePath;
import com.cspg.design.dto.ProjectInformation;
import com.cspg.design.dto.ProjectParameter;
import com.cspg.design.dto.ProjectProcessInformation;
import com.cspg.design.model.LocalStorageModel;
import com.cspg.design.model.PointDevicesModel;
import com.cspg.design.model.PolylineDevicesModel;
import com.cspg.design.model.ResponseResult;
import com.cspg.design.model.UserEIModel;
import com.cspg.design.model.UserModel;

import java.util.List;
import java.util.Map;

import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Query;
import retrofit2.http.Url;

/**
 * Created by Kun Chan on 2017/4/17.
 */

public interface IService {


    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("auth/loginnocode")
    Call<UserEIModel> login(@Body AuthUserDto authUserDto);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("LoginInterface")
    Call<UserModel> login(@Query("UserName") String UserName, @Query("PassWord") String PassWord);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("GetProjectTask")
    Call<List<ProjectDto>> project(@Query("EmployeeID") String EmployeeID);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("GetProjectHistory")
    Call<List<ProjectDto>> projectHistory(@Query("EmployeeID") String EmployeeID);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("GetProjectInformation")
    Call<ProjectInformation> projectInformation(@Query("ProjectID") String ProjectID);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("GetProjectTerrain")
    Call<List<ProjectParameter>> projectParameter(@Query("ProjectID") String ProjectID);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("GetProjectProcessInformation")
    Call<List<ProjectProcessInformation>> projectFlow(@Query("ProjectID") String ProjectID);


    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("GetProjectFilePath")
    Call<List<ProjectFilePath>> projectProjectFilePath(@Query("ProjectID") String ProjectID, @Query("UserRight") int UserRight);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("GetProjectFilePathIO")
    Call<ResponseBody> projectProjectFile(@Query("FilePath") String FilePath, @Query("Content-Type") String contentType);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("GetProjectSubmit")
    Call<ResponseResult> projectSubmit(@Query("ProjectID") String ProjectID, @Query("EmployeeID") String EmployeeID, @Query("Result") boolean Result , @Query("Remark") String Remark );

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("GetElectrifiedSubmit")
    Call<ResponseResult> projectGetElectrifiedSubmit(@Query("ProjectID") String ProjectID, @Query("ElectrifiedData") String ElectrifiedData);

    /**
     * 上传图片
     *
     * @param multipartBody
     * @return
     */
    @POST("api/localStorage/add")
    Call<ResponseBody> upload(@Url() String url, @Body MultipartBody multipartBody);

    /**
     * 上传图片
     *
     * @param multipartBodys
     * @return
     */
    @POST()
    Call<ResponseBody> uploadBatch(@Url String url, @Body List<MultipartBody> multipartBodys);
    /**
     * 简便写法
     * @param description
     * @param map
     * @return
     */
    @Multipart
    @POST("api/localStorage/add")
    Call<ResponseBody> uploadImage(@Part("description") String description, @PartMap
            Map<String, RequestBody> map);

    //多文件上传2
    @POST("api/localStorage/addBatch")
    Call<List<LocalStorageModel>> uploadFilesMultipartBody(@Body MultipartBody multipartBody);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @GET("api/PointDevice")
    Call<PointDevicesModel> getPointDeviceByProjectId(@Query("page") Integer page, @Query("size") Integer size, @Query("projectId") String projectId);
    /**
     * 批量新增线设备
     *
     * @return
     */
    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @GET("api/PolylineDevice")
    Call<PolylineDevicesModel> getPolylineDeviceByProjectId(@Query("page") Integer page, @Query("size") Integer size, @Query("projectId") String projectId);

}
